// 商品期初表
const {DataTypes, db } = require("../db");
db.define('initGoods', {
id: {type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true,comment:'表自增ID'},
tenantId:{type: DataTypes.INTEGER,allowNull:false,comment:'租户ID'}, 
locationId:{type: DataTypes.INTEGER,allowNull:false,comment:'仓库ID'}, 
locationName:{type: DataTypes.STRING(255),comment:'仓库名'}, 
invId:{type: DataTypes.INTEGER,allowNull:false,comment:'商品ID'}, 
invName:{type: DataTypes.STRING(255),comment:'名称'}, 
unit:{type: DataTypes.STRING(4),allowNull:false,comment:'单位'}, 
unitId:{type: DataTypes.INTEGER,allowNull:false,comment:''}, 
qty:{type: DataTypes.INTEGER,defaultValue:0,comment:'数量'}, 
amount:{type: DataTypes.DECIMAL(20, 2),defaultValue:0,comment:'金额'}, 
qty1:{type: DataTypes.INTEGER,defaultValue:0,comment:'大单位数量'}, 
qty2:{type: DataTypes.INTEGER,defaultValue:0,comment:'小单位数量'}, 
ctime:{type: DataTypes.STRING(20),comment:''}, 
cby:{type: DataTypes.INTEGER,comment:''}, 
createdAt:{type: DataTypes.STRING(20),comment:''}, 
uby:{type: DataTypes.INTEGER,comment:''}, 
updatedAt:{type: DataTypes.STRING(20),comment:''}, 
utime:{type: DataTypes.STRING(20),comment:''}, 

}, {
    tableName: 'init_goods',
    timestamps: false,
    comment: '商品期初表',
    indexes:[{"unique":true,"name":"同一商品只能有 1 条期初记录","fields":["tenantId"," locationId"," invId"]}]
});